class Product {
  final String id;
  final String name;
  final String description;
  final String type;
  final double price;
  final String gameId; //外键，指向Game

  Product({
    required this.id,
    required this.name,
    required this.description,
    required this.type,
    required this.price,
    required this.gameId,
  });

  factory Product.fromMap(Map<String, dynamic> map) {
    return Product(
      id: map['id'] as String,
      name: map['name'] as String,
      description: map['description'] as String,
      type: map['type'] as String,
      price: map['price'] as double,
      gameId: map['gameId'] as String,
    );
  }

  Map<String, dynamic> toMap() {
    return {
      'id': id,
      'name': name,
      'description': description,
      'type': type,
      'price': price,
      'gameId': gameId,
    };
  }
}